﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

using MiniSched.Orm;
using MiniSched.Web.Areas.Api.Models;

namespace MiniSched.Web.Areas.Api.Controllers {

    public class VolunteerApiController : EntityApiController<Volunteer, VolunteerRequestModel> {

        internal override Volunteer Create(Volunteer model) {
            if (null == model) throw new ArgumentNullException("model");

            return new Volunteer {
                EmailAddress = model.EmailAddress,
                FormattedName = model.FormattedName,
                Organization = model.Organization,
                OrganizationId = model.OrganizationId
            };
        }

        internal override void Update(Volunteer entity, Volunteer model) {
            if (null == model) throw new ArgumentNullException("model");
            if (null == entity) throw new ArgumentNullException("entity");

            entity.EmailAddress = model.EmailAddress;
            entity.FormattedName = model.FormattedName;
        }
    }
}
